package VBS;
use strict;
use=
Win32::OLE::NLS qw(:TIME
"white-space:pre"> =A0 =A0 =A0 :DATE
=A0=
=A0 =A0 GetLocaleInfo GetUserDefaultLCID
=A0 =A0 =A0 =A0 =
=A0 =A0 =A0 =A0 =A0 =A0 LOCALE_SMONTHNAME1 LOCALE_SABBREVMONTHNAME1
iv> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 LOCALE_SDAYNAME1 LOCALE_S=
ABBREVDAYNAME1
yle=3D"white-space:pre"> =A0 =A0 =A0 LOCALE_SDATE LOCALE_IDATE
v>
=
=A0 =A0 =A0 LOCALE_SGROUPING
=A0=
=A0 =A0 );
use Win32::OLE::Variant;
use=
constant EPOCH =A0 =A0 =A0 =3D> 25569;
use constant SEC_PER_D=
AY =3D> 86400;
our $lcid;
BEGIN {
=A0$lcid =
=3D GetUserDefaultLCID();
=A0Win32::OLE->Option(LCID =
=3D> $lcid);
}
# Return the local tim=
e in seconds since the epoch.
sub _localtime_in_sec {
=A0require Time::Local;
=
=A0return 2.0 * CORE::time() - Time::Local::timelocal(gmtime);<=
/div>
}
# Extract specific information out of =
a date.
sub _extract_from_date {
=A0my($date,$method,$format)=
=3D @_;
=A0return unless $date;
=A0unles=
s (UNIVERSAL::isa($date, "Win32::OLE::Variant")) {
=A0=
=A0 =A0 =A0 =A0$date =3D Variant(VT_DATE, $date);
=A0}
=A0return $date->$method($format, $lci=
d);
}
# Returns the current date and tim=
e according to the setting of your
# computer's system date a=
nd time.
sub Now {
=A0return Variant(VT_DATE, EPOCH + _localti=
me_in_sec()/SEC_PER_DAY);
}
As abo=
ve code, VB's time format is just dates wrapped by VT_DATE. Is it right=
?
And, What is lcid? What is the usage of redundant package (=A0Win32::O=
LE::NLS ) and function (=A0_extract_from_date) ?
ontent-type" content=3D"text/html; charset=3Dutf-8">
tent-type" content=3D"text/html; charset=3Dutf-8">
=A0
On Sun, Sep 19,=
2010 at 10:54 PM, John Mason Jr
<
hn.mason.jr@cox.net" target=3D"_blank">john.mason.jr@cox.net>=
wrote:
x #ccc solid;padding-left:1ex">
=A0On 9/19/2010 7:48 AM, Ludwig, Michael wrote:
>> =A0 =A0 Could you tell me how create a time object of VBS in perl?=
Below
>> statement define a starting time and pass it to the getdata functi=
on
>> to get data in VBS:
>>
>> start_time =3D DateSerial( 2003, 01, 31) + TimeSerial( 6, 0, 0)
>
>> data_array =3D lpd.getdata(id, start_time)
>>
>> But I don't know how to translate it into perl.
>> Since I intend to rewrite all vbs scripts, it will be a big proble=
m!
> Using Windows Script Files (.wsf)
>
..aspx" target=3D"_blank">http://msdn.microsoft.com/en-us/library/15 x4407c%2=
8VS.85%29.aspx
>
> WSF might be helpful to you. It allows you to have several engines
> work jointly. You might be able to keep the parts in VBS that are not<=
br>
> practical to port to Perl. It is XML, so you can use Unicode in your
r>
> script.
>
If you are doing a bunch of conversions then you might want to look a=
t
the Perl Dev Kit as it has a vbscript to perl converter
John
_______________________________________________=
ActivePerl mailing list
Ac=
tivePerl@listserv.ActiveState.com
To unsubscribe:
target=3D"_blank">http://listserv.ActiveState.com/mailman/my subs
--00163683217426f8e104909e60ca--
--===============2140351297==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============2140351297==--